﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PServiceBus.Core.Interface;
using PServiceBus.Core.Provider;
using PServiceBus.Core.Runtime.Extensions;

namespace PServiceBus.Core.Runtime.Transports {
    [Serializable]
    public class TransportInfo {
        public string Name { get; set; }
        public ITransport Transport { get; set; }
        public Guid TopicID { get; set; }

        public override bool Equals(object obj) {
            var transport = (TransportInfo)obj;
            return Name == transport.Name &&
                TopicID == transport.TopicID &&
                Transport.Serialize().IsByteEqual(transport.Transport.Serialize());
        }

        public override int GetHashCode() {
            return Name.GetHashCodeEx();
        }
    }
}
